package com.fancy.projecty.util;

import java.util.UUID;

/**
 * UUID工具类
 *
 * @author geekcattle
 */
public class UuidUtil {
	/**
	 * 获得一个UUID
	 *
	 * @return String UUID
	 */
	public static String getUUID() {
		return UUID.randomUUID().toString().replace("-", "").toLowerCase();
	}


	/**
	 * 获得32长度的UUID字符串
	 *
	 * @return
	 */
	public static String getUUID32() {
		return UUID.randomUUID().toString().replace("-", "");
	}

	/**
	 * 获得64长度的UUID字符串
	 *
	 * @return
	 */
	public static String getUUID64() {
		return getUUID() + getUUID();
	}

	/**
	 * 获得指定数目的UUID
	 *
	 * @param number int 需要获得的UUID数量
	 * @return String[] UUID数组
	 */
	public static String[] getUUID(int number) {
		if (number < 1) {
			return null;
		}
		String[] ss = new String[number];
		for (int i = 0; i < number; i++) {
			ss[i] = getUUID();
		}
		return ss;
	}
}
